package com.tc.jpa.filter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;

/**
 * @Auther: tianchao
 * @Date: 2021/11/13 14:31
 * @Description:
 */
@Slf4j
@Component
@Order(2)
public class OneFilter implements Filter {
    public OneFilter(){
        log.info("One filter construct");
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        log.info("init :{}", OneFilter.class.getName());
    }

    @Override
    public void destroy() {
        log.info("destroy :{}", OneFilter.class.getName());
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        log.info("doFilter :{}", OneFilter.class.getName());
        chain.doFilter(request, response);
    }
}
